/**
 * 文件名：      BeanUtils.java
 *
 * @author: yueji
 * @最后修改人： yueji
 * @最后修改日期:2018年1月25日 下午4:27:49
 * @version: 1.0
 * Copyright 蜀海(北京)供应链管理有限责任公司 Corporation 2018
 */
package com.taoism.utils;

import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

public class BeanUtil {

    public static List<?> copyList(List<? extends Object> poList, Class<?> voClass) {

        List<Object> voList = new ArrayList<>();

        Object voObj = null;
        for (Object poObj : poList) {
            try {
                voObj = voClass.newInstance();
            } catch (InstantiationException | IllegalAccessException e) {
                e.printStackTrace();
            }
            BeanUtils.copyProperties(poObj, voObj);
            voList.add(voObj);
        }
        return voList;

    }

    public static void copyProperties(Object sourct, Object target) {
        BeanUtils.copyProperties(sourct, target);
    }

    public static void copyProperties(Object source, Object target, Class<?> editable) {
        BeanUtils.copyProperties(source, target, editable);
    }

    public static void copyProperties(Object source, Object target, String... ignoreProperties) {
        BeanUtils.copyProperties(source, target, ignoreProperties);
    }

}
